<?php
require_once 'DBConnecter.inc';
class Attendance extends DBConnecter {
	function __construct() {
		$this->connectDB ();
		// $this->selectDB ( 'devdog' );
	}
	public function searchAttendance($mem_id, $date) {
		$sql = "CALL " . self::CONST_DB . ".attend_list_search('" . $mem_id . "','" . $date . "');";
// 		echo $sql;
		$arr1 = array ();
		$arr2 = array ();
		$i = 0;
		if ($rs = $this->getMySqlConneter ()->multi_query ( $sql )) {
			if ($rs != null && $rs = $this->getMySqlConneter ()->use_result ()) {
				while ( $row = $rs->fetch_row () ) {
					$arr1[$i] = $row['0'];
					$arr2[$i] = $row['1'];
					$i++;
				}
				$rs->free ();
				$this->attendancePrint ( $arr1, $arr2, $i );
			}
		}
	}
	public function attendancePrint( $arr1, $arr2, $i ) {
		echo "<thead><tr class='tr_head'><th colspan='".$i."'>근태현황</th></tr><tr>";
		for ($j=0; $j < $i; $j++) {
			echo "<th>".$arr1[$j]."</th>";
		}
		echo "</tr></thead><tbody><tr>";
		for ($j=0; $j < $i; $j++) {
			echo "<td>".$arr2[$j]."</td>";
		}
		echo "</tr></tbody>";
	}
}


